<template>
  <div id="index" ref="appRef">
    <div class="bg">
      <dv-loading v-if="loading">Loading...</dv-loading>
      <div v-else class="host-body">
        <!-- 顶部标题 -->
        <div class="d-flex jc-center">
          <div class="title">
            <span class="title-text">保定电信网络监控</span>
          </div>
        </div>

        <!-- 第二行 -->
        <div class="d-flex jc-between px-2 pt-8">
          <dv-decoration-6
            class="dv-dec-6"
            :reverse="true"
            :color="['#50e3c2', '#67a1e5']"
          />
        </div>

        <div class="body-box">
          <!-- 第三行数据 -->
          <dv-border-box-12 class="leftUp">
            <!-- 移动网 -->
            <center />
          </dv-border-box-12>

          <dv-border-box-12 class="leftUp1">
            <!-- 宽带网和高清网 -->
            <left-2 />
          </dv-border-box-12>

          <!-- 中间的自动旋转banner -->
          <div class="centerUp">
            <swiper />
          </div>

          <div class="centerDown"><centerDown /></div>

          <!-- 第四行数据 -->
          <dv-border-box-12 class="leftDown">
            <!-- <bottomLeft /> -->
            <bottom-left-new />
          </dv-border-box-12>

          <dv-border-box-12 class="leftDown1">
            <bottom-left-2-new />
          </dv-border-box-12>

          <dv-border-box-13 class="rightUp1">
            <!-- 卫星网 -->
            <right-up />
          </dv-border-box-13>
          <dv-border-box-13 class="rightUp2">
            <!-- 天翼云 -->
            <right-up-2 />
          </dv-border-box-13>
          <div class="rightDown1">
            <!-- 安全 -->
            <right-down-1 />
          </div>

          <dv-border-box-13 class="rightDown">
            <!-- 安全 -->
            <right-down />
          </dv-border-box-13>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
// import drawMixin from "../utils/drawMixin";
import { formatTime } from "../utils/index.js";
import centerLeft1 from "./centerLeft1";
import centerLeft2 from "./centerLeft2";
import centerDown from "./centerDown";
import centerRight2 from "./centerRight2";
import center from "./center";
import bottomLeft from "./bottomLeft";
import bottomRight from "./bottomRight";
import Left2 from "./left2.vue";
import BottomLeftNew from "./bottomLeftNew.vue";
import BottomLeft2New from "./bottom-left2-new.vue";
import RightUp from "./rightUp.vue";
import RightUp2 from "./rightUp2.vue";
import RightDown from "./rightDown.vue";
import RightDown1 from "./rightDown1.vue";
import Swiper from "@/components/swiper.vue";

export default {
  // mixins: [drawMixin],
  data() {
    return {
      timing: null,
      loading: true,
      dateDay: null,
      dateYear: null,
      dateWeek: null,
      weekday: ["周日", "周一", "周二", "周三", "周四", "周五", "周六"],
    };
  },
  components: {
    centerLeft1,
    centerLeft2,
    centerDown,
    centerRight2,
    center,
    bottomLeft,
    bottomRight,
    Left2,
    BottomLeftNew,
    BottomLeft2New,
    RightUp,
    RightUp2,
    RightDown,
    RightDown1,
    Swiper,
  },
  mounted() {
    this.timeFn();
    this.cancelLoading();
  },
  beforeDestroy() {
    clearInterval(this.timing);
  },
  methods: {
    timeFn() {
      this.timing = setInterval(() => {
        this.dateDay = formatTime(new Date(), "HH: mm: ss");
        this.dateYear = formatTime(new Date(), "yyyy-MM-dd");
        this.dateWeek = this.weekday[new Date().getDay()];
      }, 1000);
    },
    cancelLoading() {
      setTimeout(() => {
        this.loading = false;
      }, 500);
    },
  },
};
</script>

<style lang="scss">
@import "../assets/scss/index.scss";
</style>
